.include "linux.s"
.section .data
# This is where it will be stored
tmp_buffer:
    .ascii "\0\0\0\0\0\0\0\0\0\0\0"

.section .text
.globl _start
_start:
    mov     %rsp, %rbp

    # Storage for the result
    push    $tmp_buffer
    # Number to convert
    push    $824
    call integer2string
    add     $8, %rsp

    # Get the character count for our system call
    push    $tmp_buffer
    call    count_chars
    add     $8, %rsp

    # The count goes in %edx for SYS_WRITE
    mov %rax, %rdx
    # Make the system call
    mov     $SYS_WRITE, %rax
    mov     $STDOUT, %rbx
    mov     $tmp_buffer, %ecx
    int     $LINUX_SYSCALL
    
    # Write a carriage return
    push    $STDOUT
    call    write_newline  
    
    # Exit
    mov     $SYS_EXIT, %rax
    mov     $0, %rbx
    int     $LINUX_SYSCALL
